"""
Date：2019-1-11
author:YaoRuiqi
实现rgb三通道的分离与合并
"""

import cv2 as cv

def rgb(img):
    pass




def main():
    img = cv.imread("lena.png")

    height,width=img.shape[:2]

    size=(int(width*0.6)),(int(height*0.6))

    img=cv.resize(img,size)

#    cv.namedWindow("Lena")

   # cv.imshow("Lena", img)
#分离rgb三通道
    b,g,r=cv.split(img)
#合并三个通道
    merge=cv.merge([b,g,r])

    cv.imshow("Red",r)

    cv.imshow("Green",g)

    cv.imshow("Blue",b)

    cv.imshow("Merge",merge)

    cv.waitKey(0)

    #释放窗口
    cv.destroyAllWindows()

if __name__ == '__main__':
    main()






